#!/bin/bash
#yum -y update
yum -y install git
mkdir live
cd live/
git clone https://gitee.com/tbhflxhn/EasyPlayer.js.git
git clone https://gitee.com/kanggeyyds/srs.git
cd /root/live/srs/trunk
./configure
make
\./objs/srs -c conf/srs.conf\
echo "正在安装 Httpd 服务"
yum -y install httpd
service httpd start
cp  /root/live/EasyPlayer.js/element/EasyPlayer-element.min.js /var/www/html/
var=$(curl ifconfig.me)
echo "<!DOCTYPE html>
<html>
  <head>
    <title>easyplayer</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta
      content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
      name="viewport"
    />
    <script type="text/javascript" src="EasyPlayer-element.min.js"></script>
  </head>
  <body>
    <easy-player
      video-url="http://$var:8080/live/livestream.m3u8"
      live="ture"
      stretch="true"
    ></easy-player>
  </body>
</html>
" > /var/www/html/index.html
echo "稍等一下正在检测配置是否正确"
sleep 3
cd /root/live/srs/trunk
./configure
sleep 5
cd /root/live/srs/trunk
make
sleep 5
cd /root/live/srs/trunk
\./objs/srs -c conf/srs.conf\
sleep 5
cd /root/live/srs/trunk
\./objs/srs -c conf/srs.conf\
sleep 10
cd /root/live/srs/trunk
./objs/srs -c conf/srs.conf
echo "网页访问[http://$var]可以访问代表成功"

